{
 "cells": [
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "import k3d\n",
    "\n",
    "plot = k3d.plot()\n",
    "plot += k3d.text2d('\\\\int_{-\\\\infty}^\\\\infty \\\\hat f(\\\\xi)\\\\,e^{2 \\\\pi i \\\\xi x} \\\\,d\\\\xi', \n",
    "                   [0.75,0.5], color=0, size=1.5, reference_point='lt')\n",
    "plot += k3d.text2d('{(1,1,\\\\frac{5}{\\\\pi})}', [0.25, 0.5], \n",
    "                   color=0, size=1.5, reference_point='rb')\n",
    "plot += k3d.text2d('<h1 style=\"color: red;\">Important!</h1>Hello<strong>World</strong>', [0.5, 0.5], \n",
    "                   color=0, size=1.5, is_html=True, reference_point='rb')\n",
    "plot.display()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "plot.objects[0].label_box = False"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "# Multipile texts in single object\n",
    "\n",
    "import numpy as np\n",
    "\n",
    "N = 20\n",
    "positions = np.random.randn(N,2).astype(np.float32)\n",
    "\n",
    "plot2 = k3d.plot()\n",
    "obj = k3d.text2d([\"lorem ipsum\"] * N, positions, is_html=True)\n",
    "plot2 += obj\n",
    "plot2.display()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "obj.text= list(map(lambda a: str(a), list(range(N))))"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "obj.position = np.random.randn(N,2).astype(np.float32)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": []
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3 (ipykernel)",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.9.12"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 4
}
